# This Python file uses the following encoding: utf-8
import re
import sys
import time
import datetime
import logging
import  json
from elasticsearch import Elasticsearch
# 10.15.212.31  online
es = Elasticsearch(hosts='10.15.226.153')

# print(es.delete(index="index_id_chapter_1446710513161_20151105160153170", doc_type="chapter", id=3219914))


# es find
index_name="index_id_category_1446710198270_20151105155638279";
index_type="chapter"
# esRet=es.get(index=index_name, doc_type=index_type, id=7505661)['_source']
# print(json.dumps(esRet))

esRet=es.search(
    index=index_name,
    doc_type=index_type,
    body={
        'query':{
            # 'range':{
            #     'createTime':{
            #         'from':'20160101',
            #         'to':'20160102'
            #     }
            # }
            'match':{
                'id':99999999
            }
        }
    },
    from_=1,
    size=2,
)
print(json.dumps(esRet,indent=4))